package org.textreport.lang;

import java.util.ArrayList;
import java.util.List;

import org.textreport.core.ExecutionContext;

public class GroupBandExpression implements Expression {

	private List<Expression> list = new ArrayList<>();
	private int sourceLine;
	private String bandName;
	private Expression parent;

	public GroupBandExpression(String bandName,Expression parent) {
		this.bandName = bandName;
		this.parent = parent;
	}

	@Override
	public void eval(ExecutionContext ctx) {

		for (Expression e : list) {
			e.eval(ctx);
		}
	}

	public void addBodyExpression(Expression e) {
		list.add(e);
	}

	@Override
	public boolean hasBody() {
		return true;
	}

	@Override
	public int getSourceLine() {
		return sourceLine;
	}

	@Override
	public void setSourceLine(int line) {
		sourceLine = line;
	}

	public String getBandName() {
		return bandName;
	}

	@Override
	public Expression getParent() {
		return parent;
	}
}
